]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
appIcon: Scale and fade itself when starting drag
authorGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>
Thu, 4 Jul 2019 21:39:13 +0000 (18:39 -0300)
committerGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>
Fri, 9 Aug 2019 13:58:38 +0000 (10:58 -0300)
As per design direction, scale and fade the app icon
when starting dragging it, and show it again if the
drop is accepted. Clutter takes care of animating the
rest of icon positions through implicit animations.

Scale and fade the dragged icon while it's being dragged.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/671

js/ui/appDisplay.js
js/ui/dash.js

index d028e4cdbe4489e2dd49a5370659180c48fc6028..df608235d589c9ce94a93bd4931c3568ac2c72b8 100644 (file)
@@ -1768,6 +1768,7 @@ var AppIcon = class AppIcon {
             this._draggable = DND.makeDraggable(this.actor);
             this._draggable.connect('drag-begin', () => {
                 this._dragging = true;
+                this.scaleAndFade();
                 this._removeMenuTimeout();
                 Main.overview.beginItemDrag(this);
             });
@@ -1777,6 +1778,7 @@ var AppIcon = class AppIcon {
             });
             this._draggable.connect('drag-end', () => {
                 this._dragging = false;
+                this.undoScaleAndFade();
                 Main.overview.endItemDrag(this);
             });
         }
@@ -1972,6 +1974,24 @@ var AppIcon = class AppIcon {
     shouldShowTooltip() {
         return this.actor.hover && (!this._menu || !this._menu.isOpen);
     }
+
+    scaleAndFade() {
+        this.actor.reactive = false;
+        this.actor.ease({
+            scale_x: 0.75,
+            scale_y: 0.75,
+            opacity: 128
+        });
+    }
+
+    undoScaleAndFade() {
+        this.actor.reactive = true;
+        this.actor.ease({
+            scale_x: 1.0,
+            scale_y: 1.0,
+            opacity: 255
+        });
+    }
 };
 Signals.addSignalMethods(AppIcon.prototype);
 
index ca0257f543fb332398971503197794002e583d8d..b7ed5874c2faa18947bdd141945dd0c7a5204155 100644 (file)
@@ -453,16 +453,6 @@ var Dash = class Dash {
         let appIcon = new AppDisplay.AppIcon(app,
                                              { setSizeManually: true,
                                                showLabel: false });
-        if (appIcon._draggable) {
-            appIcon._draggable.connect('drag-begin',
-                                       () => {
-                                           appIcon.actor.opacity = 50;
-                                       });
-            appIcon._draggable.connect('drag-end',
-                                       () => {
-                                           appIcon.actor.opacity = 255;
-                                       });
-        }
 
         appIcon.connect('menu-state-changed',
                         (appIcon, opened) => {